2f0813aa3ecd0f99815b5ecd4e9cd40dc165a097,engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java,Upgrade450to451,encryptIpSecPresharedKeysOfRemoteAccessVpn,#Connection#,120

Before Change


        PreparedStatement updateStatement = null;
        ResultSet resultSet = null;
        try {
            selectStatement = conn.prepareStatement("SELECT id, ipsec_psk FROM `cloud`.`remote_access_vpn`");
            resultSet = selectStatement.executeQuery();
            while (resultSet.next()) {
                Long rowId = resultSet.getLong(1);
                String preSharedKey = resultSet.getString(2);
                try {
                    preSharedKey = DBEncryptionUtil.decrypt(preSharedKey);
                } catch (EncryptionOperationNotPossibleException ignored) {
                    s_logger.debug("The ipsec_psk preshared key id=" + rowId + "in remote_access_vpn is not encrypted, encrypting it.");
                }
                updateStatement = conn.prepareStatement("UPDATE `cloud`.`remote_access_vpn` SET ipsec_psk=? WHERE id=?");
                updateStatement.setString(1, DBEncryptionUtil.encrypt(preSharedKey));
                updateStatement.setLong(2, rowId);
                updateStatement.executeUpdate();
                updateStatement.close();
            }
        } catch (SQLException e) {
            throw new CloudRuntimeException("Unable to update the remote_access_vpn's preshared key ipsec_psk column", e);

After Change


                }
                try (PreparedStatement updateStatement = conn.prepareStatement("UPDATE `cloud`.`remote_access_vpn` SET ipsec_psk=? WHERE id=?");) {
                    updateStatement.setString(1, DBEncryptionUtil.encrypt(preSharedKey));
                    updateStatement.setLong(2, rowId);
                    updateStatement.executeUpdate();
                }
            }
        } catch (SQLException e) {